package view;

import controller.ControlPanel;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import model.ArtikelFilm;
import model.Klant;
import model.LoginAccount;
import model.Reservering;
import org.joda.time.DateTime;
import org.joda.time.Days;

/**
 * Klanten paneel met velden om klanten te zoeken, wijzigingen aan te brengen.
 * 
 */
public class Klanten extends javax.swing.JPanel {

    private ControlPanel controlpanel = null;
    private Klant klant = null;
    private MainFrame mainframe;
    TableModel modelReservering = null;
    TableModel modelInBezit = null;
    List<ArtikelFilm> lijstInBezit;

    /**
     * Creates new form Klanten
     *
     * @param controlpanel
     * @param main
     */
    public Klanten(ControlPanel controlpanel, MainFrame mainframe) {
        this.controlpanel = controlpanel;
        this.mainframe = mainframe;
        initComponents();
        if ( klant == null ) {
            this.jBTAaanpassen.setEnabled(false);
            this.jBTVerhuur.setEnabled(false);
            this.jBTVerwijderen.setEnabled(false);
//            this.jBTNieuw.setEnabled(false);
            this.jBTInnemen.setEnabled(false);
            this.jBTSelecteren.setEnabled(false);
            this.jBTOpheffenReservering.setEnabled(false);
            this.jBTHuur.setEnabled(false);
        }
    }
    
    /**
     * Zet data in tabel met waarden uit velden.
     */
    private void updateReserveringTabel() {
        List<String> columnsReservering = new ArrayList<String>();
        List<String[]> valuesReservering = new ArrayList<String[]>();

        columnsReservering.add("ReserveringID");
        columnsReservering.add("Artikelnr");
        columnsReservering.add("Titel");
        columnsReservering.add("Uitvoering");
        columnsReservering.add("Medium");
        columnsReservering.add("Gereserveerd op");
        
        List<Reservering> lijstReservering = controlpanel.zoekReserveringenBijKlant(klant);
        if (lijstReservering.size() > 0) {
           for (Reservering res : lijstReservering) {
                String gereserveerdOp = controlpanel.zoekGereserveerdOp(res.getReserveringID());
                String reserveringID = "" + res.getReserveringID();
                String artikelnr = "" + res.getArtikelFilm().getArtikelNummer();
                valuesReservering.add(new String[]{reserveringID, artikelnr, res.getArtikelFilm().getTitel(), res.getArtikelFilm().getUitvoering().toString(), res.getArtikelFilm().getDatadrager().toString(), gereserveerdOp});
            }

            modelReservering = new DefaultTableModel(valuesReservering.toArray(new Object[][]{}), columnsReservering.toArray());
            jTGereserveerd.setModel(modelReservering);
            jTGereserveerd.getColumnModel().getColumn(0).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(0).setPreferredWidth(50);
            jTGereserveerd.getColumnModel().getColumn(1).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(1).setPreferredWidth(50);
            jTGereserveerd.getColumnModel().getColumn(2).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(2).setPreferredWidth(250);
            jTGereserveerd.getColumnModel().getColumn(3).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(3).setPreferredWidth(100);
            jTGereserveerd.getColumnModel().getColumn(4).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(4).setPreferredWidth(50);
            jTGereserveerd.getColumnModel().getColumn(5).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(5).setPreferredWidth(100);
            this.jBTOpheffenReservering.setEnabled(true);
            this.jBTHuur.setEnabled(true);
        }else{
            DefaultTableModel dmr = (DefaultTableModel) jTGereserveerd.getModel();
            dmr.getDataVector().removeAllElements();
            dmr.fireTableDataChanged();
            this.jBTOpheffenReservering.setEnabled(false);
            this.jBTHuur.setEnabled(false);
        }
    }
    
    /**
     * Populate tabel met data aan de hand van ingevulde waarden.
     */
    private void updateInBezitTabel() {
        int klantnr = klant.getKlantnummer();
        List<String> columnsInBezit = new ArrayList<String>();
        List<String[]> valuesInBezit = new ArrayList<String[]>();
                
        columnsInBezit.add("Artikelnr");
        columnsInBezit.add("Titel");
        columnsInBezit.add("Uitvoering");
        columnsInBezit.add("Medium");
        columnsInBezit.add("Gehuurd tot");

        lijstInBezit = controlpanel.zoekGehuurdDoorKlant(klantnr);
        if (lijstInBezit.size() > 0) {
            for (ArtikelFilm af : lijstInBezit) {
                java.sql.Date gehuurdTot = controlpanel.zoekGehuurdTot(klantnr);
                String artikelnr = "" + af.getArtikelNummer();
                valuesInBezit.add(new String[]{artikelnr, af.getTitel(), af.getUitvoering().toString(), af.getDatadrager().toString(), gehuurdTot.toString()});
            }
            modelInBezit = new DefaultTableModel(valuesInBezit.toArray(new Object[][]{}), columnsInBezit.toArray());
            jTInBezit.setModel(modelInBezit);
            jTInBezit.getColumnModel().getColumn(0).setResizable(false);
            jTInBezit.getColumnModel().getColumn(0).setPreferredWidth(50);
            jTInBezit.getColumnModel().getColumn(1).setResizable(false);
            jTInBezit.getColumnModel().getColumn(1).setPreferredWidth(250);
            jTInBezit.getColumnModel().getColumn(2).setResizable(false);
            jTInBezit.getColumnModel().getColumn(2).setPreferredWidth(100);
            jTInBezit.getColumnModel().getColumn(3).setResizable(false);
            jTInBezit.getColumnModel().getColumn(3).setPreferredWidth(100);
            jTInBezit.getColumnModel().getColumn(4).setResizable(false);
            jTInBezit.getColumnModel().getColumn(4).setPreferredWidth(100);
            this.jBTInnemen.setEnabled(true);
        }else{
            DefaultTableModel dmr = (DefaultTableModel) jTInBezit.getModel();
            dmr.getDataVector().removeAllElements();
            dmr.fireTableDataChanged();
            this.jBTInnemen.setEnabled(false);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jBTInnemen1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTFZoekKlantNummer = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTFZoekAchternaam = new javax.swing.JTextField();
        jTFZoekStraatnaam = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTFZoekTelefoonnummer = new javax.swing.JTextField();
        jBTZoek = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jTFToonVoornaam = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTFToonAchternaam = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTFToonStraat = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jTFToonHuisnummer = new javax.swing.JTextField();
        jTFToonWoonplaats = new javax.swing.JTextField();
        jTFToonTelefoonnummer = new javax.swing.JTextField();
        jBTNieuw = new javax.swing.JButton();
        jBTAaanpassen = new javax.swing.JButton();
        jBTVerwijderen = new javax.swing.JButton();
        jBTVerhuur = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTInBezit = new javax.swing.JTable();
        jLabel15 = new javax.swing.JLabel();
        jBTInnemen = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTKlant = new javax.swing.JTable();
        jBTSelecteren = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTGereserveerd = new javax.swing.JTable();
        jBTOpheffenReservering = new javax.swing.JButton();
        jBTHuur = new javax.swing.JButton();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        jBTInnemen1.setText("Innemen");

        jLabel1.setFont(new java.awt.Font("Cambria", 0, 36)); // NOI18N
        jLabel1.setText("Klanten");

        jLabel2.setText("Klantnummer");

        jLabel3.setText("Achternaam");

        jLabel4.setText("Straatnaam");

        jLabel5.setText("Telefoonnummer");

        jBTZoek.setText("Zoek");
        jBTZoek.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTZoekActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
        jLabel6.setText("Klantgegevens");

        jLabel7.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
        jLabel7.setText("Zoek een klant");

        jLabel8.setText("Voornaam");

        jLabel9.setText("Achternaam");

        jLabel10.setText("Straat");
        jLabel10.setToolTipText("");

        jLabel11.setText("Huisnummer");

        jLabel12.setText("Woonplaats");

        jLabel13.setText("Telefoonnummer");

        jBTNieuw.setText("Nieuw");
        jBTNieuw.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTNieuwActionPerformed(evt);
            }
        });

        jBTAaanpassen.setText("Aanpassen");
        jBTAaanpassen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTAaanpassenActionPerformed(evt);
            }
        });

        jBTVerwijderen.setText("Verwijderen");
        jBTVerwijderen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTVerwijderenActionPerformed(evt);
            }
        });

        jBTVerhuur.setText("Verhuur");
        jBTVerhuur.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTVerhuurActionPerformed(evt);
            }
        });

        jTInBezit.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Artikelnummer", "Titel", "Uitvoering", "Medium", "Gehuurd tot"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTInBezit.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTInBezit.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(jTInBezit);
        jTInBezit.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (jTInBezit.getColumnModel().getColumnCount() > 0) {
            jTInBezit.getColumnModel().getColumn(0).setResizable(false);
            jTInBezit.getColumnModel().getColumn(0).setPreferredWidth(50);
            jTInBezit.getColumnModel().getColumn(1).setResizable(false);
            jTInBezit.getColumnModel().getColumn(1).setPreferredWidth(250);
            jTInBezit.getColumnModel().getColumn(2).setResizable(false);
            jTInBezit.getColumnModel().getColumn(2).setPreferredWidth(100);
            jTInBezit.getColumnModel().getColumn(3).setResizable(false);
            jTInBezit.getColumnModel().getColumn(3).setPreferredWidth(100);
            jTInBezit.getColumnModel().getColumn(4).setResizable(false);
            jTInBezit.getColumnModel().getColumn(4).setPreferredWidth(100);
        }

        jLabel15.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
        jLabel15.setText("Films in bezit");

        jBTInnemen.setText("Innemen");
        jBTInnemen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTInnemenActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
        jLabel14.setText("Zoek resultaat");

        jTKlant.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Klantnummer", "Voornaam", "Achternaam", "Adres", "Woonplaats", "Telefoonnummer"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTKlant.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jTKlant.getTableHeader().setReorderingAllowed(false);
        jScrollPane3.setViewportView(jTKlant);
        if (jTKlant.getColumnModel().getColumnCount() > 0) {
            jTKlant.getColumnModel().getColumn(0).setResizable(false);
            jTKlant.getColumnModel().getColumn(0).setPreferredWidth(50);
            jTKlant.getColumnModel().getColumn(1).setResizable(false);
            jTKlant.getColumnModel().getColumn(1).setPreferredWidth(100);
            jTKlant.getColumnModel().getColumn(2).setResizable(false);
            jTKlant.getColumnModel().getColumn(2).setPreferredWidth(100);
            jTKlant.getColumnModel().getColumn(3).setResizable(false);
            jTKlant.getColumnModel().getColumn(3).setPreferredWidth(100);
            jTKlant.getColumnModel().getColumn(4).setResizable(false);
            jTKlant.getColumnModel().getColumn(4).setPreferredWidth(50);
            jTKlant.getColumnModel().getColumn(5).setResizable(false);
            jTKlant.getColumnModel().getColumn(5).setPreferredWidth(100);
        }

        jBTSelecteren.setText("Selecteren");
        jBTSelecteren.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTSelecterenActionPerformed(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
        jLabel16.setText("Films gereserveerd");

        jTGereserveerd.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "ReserveringID", "Artikelnummer", "Titel", "Uitvoering", "Medium", "Gereserveerd op"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                true, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTGereserveerd.getTableHeader().setReorderingAllowed(false);
        jScrollPane4.setViewportView(jTGereserveerd);
        jTGereserveerd.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (jTGereserveerd.getColumnModel().getColumnCount() > 0) {
            jTGereserveerd.getColumnModel().getColumn(0).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(0).setPreferredWidth(50);
            jTGereserveerd.getColumnModel().getColumn(1).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(1).setPreferredWidth(250);
            jTGereserveerd.getColumnModel().getColumn(2).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(2).setPreferredWidth(100);
            jTGereserveerd.getColumnModel().getColumn(3).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(3).setPreferredWidth(100);
            jTGereserveerd.getColumnModel().getColumn(4).setResizable(false);
            jTGereserveerd.getColumnModel().getColumn(4).setPreferredWidth(100);
        }

        jBTOpheffenReservering.setText("Cancel reservering");
        jBTOpheffenReservering.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTOpheffenReserveringActionPerformed(evt);
            }
        });

        jBTHuur.setText("Verhuur");
        jBTHuur.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTHuurActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(141, 141, 141)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jBTHuur)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBTOpheffenReservering))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel16)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jBTInnemen))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel15)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jBTSelecteren))
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel1)
                                        .addComponent(jLabel7))
                                    .addGap(182, 182, 182))
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel2)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addComponent(jTFZoekKlantNummer, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(35, 35, 35)
                                                    .addComponent(jBTZoek, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jTFZoekAchternaam, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel3))
                                                .addGap(35, 35, 35)
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jTFZoekStraatnaam, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel4)))
                                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jTFZoekTelefoonnummer, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGap(68, 68, 68)))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addComponent(jBTNieuw)
                                    .addGap(30, 30, 30)
                                    .addComponent(jBTAaanpassen)
                                    .addGap(31, 31, 31)
                                    .addComponent(jBTVerhuur, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                                    .addComponent(jBTVerwijderen, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(jLabel11)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(jTFToonHuisnummer)
                                                            .addGap(58, 58, 58)))
                                                    .addComponent(jTFToonWoonplaats, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jTFToonVoornaam, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGap(58, 58, 58)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel9)
                                                        .addComponent(jTFToonAchternaam, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel12))))
                                            .addGap(56, 56, 56))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                            .addComponent(jLabel6)
                                            .addGap(201, 201, 201)))
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jTFToonStraat)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(jLabel13)
                                            .addGap(2, 2, 2))
                                        .addComponent(jTFToonTelefoonnummer))
                                    .addGap(1, 1, 1))))))
                .addContainerGap(125, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(jLabel10)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTFToonStraat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jTFToonVoornaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(10, 10, 10))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTFToonAchternaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTFToonTelefoonnummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTFToonWoonplaats, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTFToonHuisnummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(31, 31, 31)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jBTNieuw)
                            .addComponent(jBTAaanpassen)
                            .addComponent(jBTVerhuur)
                            .addComponent(jBTVerwijderen)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTFZoekKlantNummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jBTZoek))
                        .addGap(3, 3, 3)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTFZoekAchternaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTFZoekStraatnaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTFZoekTelefoonnummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jLabel14)
                .addGap(2, 2, 2)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(jBTSelecteren))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel15)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBTInnemen))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel16)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBTOpheffenReservering)
                    .addComponent(jBTHuur))
                .addGap(19, 19, 19))
        );
    }// </editor-fold>//GEN-END:initComponents
    /**
     * Bij aanmaken van een klant door de medewerker, wordt een username en
     * wachtwoord gegenereerd Username: <voornaam><huisnummer>
     * Password: Welkom<voornaam>
     *
     * @param evt
     */
    private void jBTNieuwActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTNieuwActionPerformed
        boolean result = false;
        String achternaam = jTFToonAchternaam.getText();
        String voornaam = jTFToonVoornaam.getText();
        String straat = jTFToonStraat.getText();
        String huisnummer = jTFToonHuisnummer.getText();
        String telefoonnummer = jTFToonTelefoonnummer.getText();
        String woonplaats = jTFToonWoonplaats.getText();
        String username = jTFToonVoornaam.getText() + jTFToonHuisnummer.getText();
        String password = "Welkom" + jTFToonVoornaam.getText();

        if (achternaam.isEmpty() || voornaam.isEmpty() || straat.isEmpty()
                || huisnummer.isEmpty() || telefoonnummer.isEmpty()
                || woonplaats.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Fout, zorg dat alle velden ingevuld zijn");
        } else {
            LoginAccount loginAccount = new LoginAccount(username, password);
            Klant k = new Klant(loginAccount, voornaam, achternaam, straat, huisnummer, telefoonnummer, woonplaats);
            result = controlpanel.toevoegenKlant(k);

            if (result) {
                JOptionPane.showMessageDialog(null, "Nieuwe klant toegevoegd");
            } else {
                JOptionPane.showMessageDialog(null, "Fout, er is iets misgegaan met opslaan");
            }
        }

    }//GEN-LAST:event_jBTNieuwActionPerformed

    /**
     * Zoek opdracht versturen met ingevulde waarden.
     * @param evt 
     */
    private void jBTZoekActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTZoekActionPerformed
        String klantnummerStr = "";
        int klantnummer = -1;
        String achternaam = "";
        String straatnaam = "";
        String telefoonnummer = "";
        this.jBTHuur.setEnabled(false);
        this.jBTOpheffenReservering.setEnabled(false);
        
        TableModel modelklant = new DefaultTableModel();
        if (!jTFZoekKlantNummer.getText().isEmpty() || !jTFZoekAchternaam.getText().isEmpty() || !jTFZoekStraatnaam.getText().isEmpty() || !jTFZoekTelefoonnummer.getText().isEmpty()) {
            if (!jTFZoekKlantNummer.getText().isEmpty()) {
                klantnummerStr = jTFZoekKlantNummer.getText();
                klantnummer = Integer.parseInt(klantnummerStr);
            } else {

                if (!jTFZoekAchternaam.getText().isEmpty()) {
                    achternaam = jTFZoekAchternaam.getText();
                }

                if (!jTFZoekStraatnaam.getText().isEmpty()) {
                    straatnaam = jTFZoekStraatnaam.getText();
                }

                if (!jTFZoekTelefoonnummer.getText().isEmpty()) {
                    telefoonnummer = jTFZoekTelefoonnummer.getText();
                }

            }

            List<Klant> klantresultlist = controlpanel.zoekenOpKlantgegevens(klantnummer, achternaam, straatnaam, telefoonnummer);
            List<String> columnsKlant = new ArrayList<String>();
            List<String[]> valuesKlant = new ArrayList<String[]>();
            
            if (klantresultlist.size() > 0) {
            
                columnsKlant.add("Klantnr");
                columnsKlant.add("Voornaam");
                columnsKlant.add("Achternaam");
                columnsKlant.add("Adres");
                columnsKlant.add("Woonplaats");
                columnsKlant.add("Telefoonnummer");

                for (Klant k : klantresultlist) {
                    String klantnr = String.valueOf(k.getKlantnummer());
                    valuesKlant.add(new String[]{klantnr, k.getNaam(), k.getAchternaam(), k.getStraat() + "  " + k.getHuisnummer(), k.getWoonplaats(), k.getTelefoonnummer()});
                }

                modelklant = new DefaultTableModel(valuesKlant.toArray(new Object[][]{}), columnsKlant.toArray());

                jTKlant.setModel(modelklant);
                
                DefaultTableModel dmr = (DefaultTableModel) jTGereserveerd.getModel();
                dmr.getDataVector().removeAllElements();
                dmr.fireTableDataChanged();
                
                DefaultTableModel dmib = (DefaultTableModel) jTInBezit.getModel();
                dmib.getDataVector().removeAllElements();
                dmib.fireTableDataChanged();
                this.jBTSelecteren.setEnabled(true);
            }
                
        } else {
            JOptionPane.showMessageDialog(null, "Er moet minimaal 1 veld ingevuld zijn");
        }

    }//GEN-LAST:event_jBTZoekActionPerformed

    /**
     * Data ophalen en in velden en tabellen zetten na het versturen van een selectie opdracht.
     * @param evt 
     */
    private void jBTSelecterenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTSelecterenActionPerformed
        int rij = jTKlant.getSelectedRow();
        int klantnr = Integer.parseInt(jTKlant.getModel().getValueAt(rij, 0).toString());
        klant = controlpanel.zoekOpKlantnr(klantnr);
        modelReservering = new DefaultTableModel();
        modelInBezit = new DefaultTableModel();

        if (klant != null) {
            jTFToonVoornaam.setText(klant.getNaam());
            jTFToonAchternaam.setText(klant.getAchternaam());
            jTFToonStraat.setText(klant.getStraat());
            jTFToonHuisnummer.setText(klant.getHuisnummer());
            jTFToonWoonplaats.setText(klant.getWoonplaats());
            jTFToonTelefoonnummer.setText(klant.getTelefoonnummer());

            this.updateReserveringTabel();
            this.updateInBezitTabel();
            
            this.jBTAaanpassen.setEnabled(true);
            this.jBTVerwijderen.setEnabled(true);
            this.jBTVerhuur.setEnabled(true);
            this.jBTNieuw.setEnabled(false);
        }
    }//GEN-LAST:event_jBTSelecterenActionPerformed

    /**
     * Verhuur opdracht versturen met geselecteerde item.
     * @param evt 
     */
    private void jBTVerhuurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTVerhuurActionPerformed
        boolean magHuren = true;
        String teLangInBezit = null;
        if (klant != null) {
            for (ArtikelFilm af : lijstInBezit) {
                java.sql.Date gehuurdTot = controlpanel.zoekGehuurdTot(klant.getKlantnummer());
                java.sql.Date vandaag = new java.sql.Date(new java.util.Date().getTime());
                int days = Days.daysBetween(new DateTime(gehuurdTot), new DateTime(vandaag)).getDays();
                if ( days >= 7) {
                    magHuren = false;
                    teLangInBezit = af.getArtikelNummer() + ", " + af.getTitel();
                }
            }
            if (magHuren) {
                mainframe.showFilmsForm(klant);
            }else{
                JOptionPane.showMessageDialog(null, "Film langer dan een week in bezit: " + teLangInBezit, null, JOptionPane.INFORMATION_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Geen klant geselecteerd");
        }
    }//GEN-LAST:event_jBTVerhuurActionPerformed

    /**
     * Aanpas opdracht versturen met gewijzigde velden.
     * @param evt 
     */
    private void jBTAaanpassenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTAaanpassenActionPerformed
        boolean result = false;
        int klantnummer = klant.getKlantnummer();
        String voornaam = jTFToonVoornaam.getText();
        String achternaam = jTFToonAchternaam.getText();
        String straatnaam = jTFToonStraat.getText();
        String huisnummer = jTFToonHuisnummer.getText();
        String woonplaats = jTFToonWoonplaats.getText();
        String telefoonnummer = jTFToonTelefoonnummer.getText();

        Klant possiblyChangedKlant = new Klant(klantnummer, voornaam, achternaam, straatnaam, huisnummer, telefoonnummer, woonplaats);

        if (klant.equals(possiblyChangedKlant)) {
            JOptionPane.showMessageDialog(null, "Er is niets gewijzigd");
        } else {
            try {
                result = controlpanel.aanpassenKlant(possiblyChangedKlant);
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "Er is een fout opgetreden bij het opslaan", null, JOptionPane.ERROR);
            }
            if (result) {
                JOptionPane.showMessageDialog(null, "De aanpassing is verwerkt", null, JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null, "Er is en fout opgetreden tijdens het opslaan", null, JOptionPane.ERROR);
            }
        }
    }//GEN-LAST:event_jBTAaanpassenActionPerformed

    /**
     * Opdracht versturen om geselecteerde reserveringitem op te heffen.
     * @param evt 
     */
    private void jBTOpheffenReserveringActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTOpheffenReserveringActionPerformed
        boolean result = false;
        if (jTGereserveerd.getSelectedRow() != -1) {
            int rij = jTGereserveerd.getSelectedRow();
            int reserveringid = Integer.parseInt(jTGereserveerd.getModel().getValueAt(rij, 0).toString());
            int artikelID = Integer.parseInt(jTGereserveerd.getModel().getValueAt(rij, 1).toString());

            result = controlpanel.annulerenReservering(klant.getKlantnummer(), artikelID, reserveringid);
            if (result) {
                DefaultTableModel dmr = (DefaultTableModel) jTGereserveerd.getModel();
                dmr.removeRow(rij);
                dmr.fireTableDataChanged();
                JOptionPane.showMessageDialog(null, "Reservering opgeheven", null, JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null, "Fout, reservering niet opgeheven", null, JOptionPane.WARNING_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Er is niets geselecteerd");
        }
    }//GEN-LAST:event_jBTOpheffenReserveringActionPerformed

    /**
     * Opdracht versturen om geselecteerde item in te nemen.
     * @param evt 
     */
    private void jBTInnemenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTInnemenActionPerformed
        if (jTInBezit.getSelectedRow() != -1) {
            int rij = jTInBezit.getSelectedRow();
            int artikelnummer = Integer.parseInt(jTInBezit.getModel().getValueAt(rij, 0).toString());
            int hoogteBoete = -1;
            int antwoord = 0;
            hoogteBoete = controlpanel.controleerDagenTeLaat(artikelnummer, artikelnummer);
            if (hoogteBoete > 0) {
                Object[] options = {"Yes",
                    "No"};
                antwoord = JOptionPane.showOptionDialog(null,
                        "Klant heeft " + hoogteBoete + " EUR boete open staan, nu voldoen?",
                        "Boete",
                        JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE,
                        null,
                        options,
                        options[0]);
            }
            if (antwoord == 0) {
                boolean result = false;
                result = controlpanel.innemenArtikel(klant.getKlantnummer(), artikelnummer);
                if (result) {
                    this.updateInBezitTabel();
                    JOptionPane.showMessageDialog(null, "De film is ingenomen");
                } else {
                    JOptionPane.showMessageDialog(null, "Fout, opslaan in db ging iets mis");
                }

            } else {
                JOptionPane.showMessageDialog(null, "Fout, klant heeft boete nog niet betaald");
            }

        } else {
            JOptionPane.showMessageDialog(null, "Er is niets geselecteerd");
        }
    }//GEN-LAST:event_jBTInnemenActionPerformed

    /*
     Verwijderen van een klant, de methode identificeert de klant op klantnummer
     */
    private void jBTVerwijderenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTVerwijderenActionPerformed

        int geselecteerdeKlantnummer = -1;
        if (klant != null) {
            geselecteerdeKlantnummer = klant.getKlantnummer();

            boolean result = false;
            result = controlpanel.verwijderenKlant(geselecteerdeKlantnummer);
            if (result) {
                JOptionPane.showMessageDialog(null, "Klant is verwijderd");
            }

        } else {
            JOptionPane.showMessageDialog(null, "Selecteer een klant");
        }


    }//GEN-LAST:event_jBTVerwijderenActionPerformed

    /**
     * Opdracht versturen om een geselecteerd item te huren.
     * @param evt 
     */
    private void jBTHuurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTHuurActionPerformed
        boolean result = false;
        int klantnummer = klant.getKlantnummer();
        if (jTGereserveerd.getSelectedRow() != -1) {
            int rij = jTGereserveerd.getSelectedRow();
            int reserveringid = Integer.parseInt(jTGereserveerd.getModel().getValueAt(rij, 0).toString());
            int artikelID = Integer.parseInt(jTGereserveerd.getModel().getValueAt(rij, 1).toString());
            
            int dagen = Integer.parseInt(JOptionPane.showInputDialog("Aantal dagen: "));
            java.sql.Date verhuurDatum = new java.sql.Date(new java.util.Date().getTime());
            java.sql.Date verstrijkDatum = new java.sql.Date(verhuurDatum.getTime() + (dagen * 1000 * 60 * 60 * 24));
            
            result = controlpanel.verhuurGereserveerdArtikel(klantnummer, artikelID, reserveringid, verhuurDatum, verstrijkDatum);
            
            if (result) {
                JOptionPane.showMessageDialog(null, "Gereserveerd artikel is nu gehuurd", null, JOptionPane.INFORMATION_MESSAGE);
                this.updateInBezitTabel();
                this.updateReserveringTabel();
            } else {
                JOptionPane.showMessageDialog(null, "Fout, reservering niet verhuurd", null, JOptionPane.WARNING_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Er is niets geselecteerd");
        }

    }//GEN-LAST:event_jBTHuurActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBTAaanpassen;
    private javax.swing.JButton jBTHuur;
    private javax.swing.JButton jBTInnemen;
    private javax.swing.JButton jBTInnemen1;
    private javax.swing.JButton jBTNieuw;
    private javax.swing.JButton jBTOpheffenReservering;
    private javax.swing.JButton jBTSelecteren;
    private javax.swing.JButton jBTVerhuur;
    private javax.swing.JButton jBTVerwijderen;
    private javax.swing.JButton jBTZoek;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTextField jTFToonAchternaam;
    private javax.swing.JTextField jTFToonHuisnummer;
    private javax.swing.JTextField jTFToonStraat;
    private javax.swing.JTextField jTFToonTelefoonnummer;
    private javax.swing.JTextField jTFToonVoornaam;
    private javax.swing.JTextField jTFToonWoonplaats;
    private javax.swing.JTextField jTFZoekAchternaam;
    private javax.swing.JTextField jTFZoekKlantNummer;
    private javax.swing.JTextField jTFZoekStraatnaam;
    private javax.swing.JTextField jTFZoekTelefoonnummer;
    private javax.swing.JTable jTGereserveerd;
    private javax.swing.JTable jTInBezit;
    private javax.swing.JTable jTKlant;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
